<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>

        /* 
            先执行捕获，在执行冒泡
         */


        window.onload = function () {
            const aObj = document.querySelector("a")

            aObj.addEventListener("click", function () {
                console.log("btn处于事件的捕获阶段")
            }, true)

            aObj.addEventListener("click", function () {
                console.log("btn处于事件的冒泡阶段")
            }, false)

            document.body.addEventListener("click", function () {
                console.log("body处于事件的捕获阶段")
            }, true)

            document.body.addEventListener("click", function () {
                console.log("body处于事件的冒泡阶段")
            }, false)

             document.documentElement.addEventListener("click", function () {
                console.log("HTML处于事件的冒泡阶段")
            }, false)

            document.documentElement.addEventListener("click", function () {
                console.log("HTML处于事件的捕获阶段")
            }, true)

            document.addEventListener("click", function () {
                console.log("document处于事件的捕获阶段")
            }, true)

            document.addEventListener("click", function () {
                console.log("document处于事件的冒泡阶段")
            }, false)
        }
    </script>
</head>

<body>
    <a href="#">捕获和冒泡同时存在的时候</a>
</body>

</html>